import React from 'react';
import { Input, Button, Select,  Form, Cascader, DatePicker, Row, Col,  Icon,  Table,Radio, Collapse, Pagination, InputNumber, message,Modal } from 'antd';
import config from '../../config/config';
import $ from 'jquery';
import './registerTriage.less';
import region from '../../common/region';
import moment from 'moment';
const token = sessionStorage.getItem('token');
const FormItem = Form.Item;
const { TextArea } = Input;
const allRouter = config.router;
const Option = Select.Option;
const Search = Input.Search;
const Panel = Collapse.Panel;
const nations = config.nationData;
let userInfo = JSON.parse(sessionStorage.getItem('UserInfo')); //用户信息
//家庭成员信息
let uuid = 0;
let descCount = 0;

//过敏源
let uuid1 = 0;
let descCount1=0;


class PatientInfoDetails1 extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            tabKey: 1,//当前显示的页面内容 1基本信息 2就诊信息 3消费信息
            tabKey1:1,//就诊信息详情  1病例   2处方   3外科治疗
            patientInfo: [],//该患者信息
            patientOriginList: [],//患者来源列表
            userTypeManageList: [],//会员类型
            isEdit1: 0,//编辑患者基本信息
            isEdit2: 0,//编辑患者家庭成员信息
            tab1Status: true,//编辑患者处方信息
            age: 0,//选择日期，计算该患者的年龄
            patientOrderInfo:[],//患者消费信息
            pagesize: 12,// 每页显示的页数
            pageindex: 1,// 当前页
            patientMoney:{},//消费信息总钱
            visible1:false,//查看费用明细模态框
            feePreviewData:[],//查看费用明细模态框data
            assistantTherapyDetails:[],//就诊信息下外科治疗详情
            totalmoney:0,//模态框总金额
            lessmoney:0,//模态框应收金额
            patientTraigeInfo:[],//就诊信息
            allergyExisted:1,//是否有过敏史
            isAlreadyChosedIdCard:false,//是否选择了证件类型，决定ID号码是否填写
            orderID:'',//展示订单详情的orderid
        }
    }
    componentWillMount() {
        //为了防止增加后立马编辑而uuid没有清0
        uuid = 0;
        //获取该患者信息
        this.getThisPatientInfo();
        //获取会员类型列表
        this.getUsersList();
        //获取患者来源列表
        this.getOriginPatientList();

    }
    componentDidMount() {
        //处理省市区数据
        this.handleRegion();
    }

    //移除过敏源
    remove1 (k,index,i){ // k: uuid index: 过敏源对应数组下标 i: 父级病例史
        const { form } = this.props;
        const keys1 = form.getFieldValue('keys1');
        if (keys1.length === 0) {
            return;
        }
        descCount1++;
        form.setFieldsValue({
            keys1: keys1.filter(key => key !== k),
        });
        // 删除过敏源对应项
        this.state.patientTraigeInfo[i].irritabilityDetails.splice(index+1,1);
        
       this.forceUpdate();
        
    }
    //增加过敏源
    add1 (){
        const { form } = this.props;
        const keys = form.getFieldValue('keys1');
        console.log(keys);
        const nextKeys = keys.concat(uuid1);
        console.log(nextKeys);
        uuid1++;
        form.setFieldsValue({
            keys1: nextKeys,
        });
    }
    // 获取该患者信息
    getThisPatientInfo() {
        let url = allRouter.patientOrigin + '/patient/one/' + this.props.params.patientId;
        $.ajax({
            url: url,
            type: "get",
            async: true,
            headers: { Authorization: 'Bearer '+sessionStorage.getItem('token')},
            success: data => {
                console.log(data);
                if (data.code === 200) {
                    this.setState({
                        patientInfo: data.data
                    })
                } else {
                    console.log("获取该患者信息出错");
                }
            },
            error: err => {
                console.log(err);
            }
        })
    }
    //处理省市区数据
    handleRegion() {
        const setOptions = arr => {
            arr.map((item, key) => {
                item.value = item.name;
                item.label = item.name;
                if (item.child) {
                    item.children = item.child;
                    setOptions(item.children);
                }
            });
        };
        setOptions(region);
        this.setState({
            region
        });
    }
    //获取患者消费信息
    getPatientPayDetails(pageindex){
        let url = allRouter.patientOrigin + '/order/onsumerinforMation?id='+this.props.params.patientId+'&pageindex='+pageindex;
        $.ajax({
            url: url,
            type: "get",
            async: true,
            headers: { Authorization: 'Bearer '+sessionStorage.getItem('token')},
            success: data => {
                console.log(data);
                if (data.code === 200) {
                    data.data.forEach((item,i)=>{
                        item.index=i+1;
                    });
                    this.setState({
                        patientOrderInfo: data.data,
                        patientMoney:{total:data.totalaMount?data.totalaMount:0,refound:data.refundmoney?data.refundmoney:0}
                    })
                } else {
                    console.log("获取该患者信息出错");
                }
            },
            error: err => {
                console.log(err);
            }
        })
    }
    //改变tab页面 切换登记记录与新增患者页面内容
    changeTab(key) {
        this.setState({ tabKey: key });
        if(key===3){
            this.getPatientPayDetails(1);
        }
        if(key===2){
            this.getPatientTriageInfo();
        }
    }
    //就诊详细信息tab切换
    changeTab1(key) {
        this.setState({ tabKey1: key });
        this.getPatientTriageInfo();
    }
    //获取患者就诊信息
    getPatientTriageInfo(){
        let url = allRouter.patientOrigin + '/surgicalTreatment/treatmentlook/'+this.props.params.patientId;
        $.ajax({
            url:url,
            type: "GET",
            async: true,
            headers: { Authorization: 'Bearer '+sessionStorage.getItem('token')},
            success:data=>{
                console.log(data);
                if (data.code === 200) {
                    this.setState({
                        patientTraigeInfo:data.data,
                    });
                    if(data.data.length>0){
                        if(data.data[0].irritability!=="有"){
                            this.setState({
                                allergyExisted:0
                            })
                        }
                    }
                    if(data.data.length>0){
                        uuid1 = 0;
                        const { form } = this.props;
                        form.setFieldsValue({
                            keys1: [],
                        });
                        let count=data.data[0].irritabilityDetails&&data.data[0].irritabilityDetails.length;
                        for(let i=1;i<count;i++){
                            this.add1();
                        }
                    }
                } else {
                    console.log("获取患者就诊信息出错");
                }
            },
            error:err=>{
                console.log(err);
            }
        });
    }
    //获取患者来源列表
    getOriginPatientList() {
        let url = allRouter.patientOrigin + '/source/list';
        //console.log(url);
        $.ajax({
            url:url,
            type: "GET",
            async: true,
            headers: { Authorization: 'Bearer '+sessionStorage.getItem('token')},
            success:data=>{
                console.log(data);
                if (data.code === 200) {
                    //对禁用的数据进行过滤
                    this.setState({
                        patientOriginList: data.sources.filter(key => key.state !== '禁用')
                    }, () => {
                        console.log(this.state.patientOriginList);
                    })
                } else {
                    console.log("获取患者来源列表出错");
                }
            },
            error:err=>{
                console.log(err);
            }
        });
    }
    //获取会员类型列表
    getUsersList() {
        let url = allRouter.patientOrigin + '/grade/list';
        //console.log(url);
        $.ajax({
            url:url,
            type: "GET",
            async: true,
            headers: { Authorization: 'Bearer '+sessionStorage.getItem('token')},
            success:data=>{
                this.setState({
                    userTypeManageListCount: data.gread.length
                });
                if (data.code === 200) {
                    this.setState({ userTypeManageList: data.gread.filter(key => key.state !== '禁用') }, () => {
                        console.log(this.state.userTypeManageList);
                    })
                } else {
                    console.log("获取会员类型列表出错");
                }
            },
            error:err=>{
                console.log(err);
            }
        });
    }
    //点击编辑患者基本信息
    handleChangePatientInfo(key) {
        this.setState({
            isEdit1: key
        }, () => {
            if (key === 1) {
                let values = this.state.patientInfo;
                this.setState({
                    isAlreadyChosedIdCard:false
                });
                if(values.userpapers){
                    this.setState({
                        isAlreadyChosedIdCard:true
                    })
                }
                this.props.form.setFieldsValue({
                    name: values.username,
                    gender: values.usersex,
                    birthday: values.userbirthday ? moment(values.userbirthday) : null,
                    phone: values.userphone,
                    cardType: values.userpapers,
                    card: values.userIDcard,
                    address: values.userprovince ? values.userprovince.split('/') : [],
                    addressDetail: values.useraddress,
                    patientCardId: values.membercardno,
                    patientOrigin: values.usersource,
                    userType: values.membertypes,
                    marryState: values.usermarriage,
                    job: values.userproffession,
                    jobAddress: values.userworkunit,
                    nation: values.usernation,
                    email: values.useremail,
                    height: values.signmes[0].height ? values.signmes[0].height : '',
                    weight: values.signmes[0].weight ? values.signmes[0].weight : '',
                    // pulse:values.signmes?values.signmes.pulse:'',//脉搏
                    // breath:values.signmes?values.signmes.breathe:'',//呼吸
                    // bloodPressure:values.signmes?values.signmes.bloodpressure:'',//血压
                });
            }
        })
    }
    //保存患者基本信息
    savePatientInfo() {
        this.props.form.validateFields((err, fieldsValue) => {
            console.log(err, fieldsValue);
            if (!err) {
                const values = {
                    ...fieldsValue,
                    'birthday': fieldsValue['birthday'].format('YYYY-MM-DD'),
                };
                let url = allRouter.patientOrigin + '/patient/update';
                $.ajax({
                    url: url,
                    type: "post",
                    async: true,
                    traditional: true,
                    headers: { Authorization: 'Bearer '+sessionStorage.getItem('token')},
                    data: {
                        id: this.state.patientInfo._id,
                        username: values.name,
                        usersex: values.gender,
                        userbirthday: values.birthday,
                        userphone: values.phone,
                        userpapers: values.cardType,
                        userIDcard: values.card,
                        userprovince: values.address ? values.address.join('/') : undefined,
                        useraddress: values.addressDetail,
                        membercardno: values.patientCardId,
                        usersource: values.patientOrigin,
                        membertypes: values.userType,
                        usermarriage: values.marryState,
                        userproffession: values.job,
                        userworkunit: values.jobAddress,
                        usernation: values.nation,
                        useremail: values.email,
                        signmes: JSON.stringify([{ height: values.height, weight: values.weight, pulse: this.state.patientInfo.signmes[0].pulse, breathe: this.state.patientInfo.signmes[0].breathe, bloodpressure: this.state.patientInfo.signmes[0].bloodpressure }]),
                    },
                    success: data => {
                        console.log(data);
                        if (data.code === 200) {
                            message.info('患者信息修改成功');
                            this.getThisPatientInfo();
                            this.setState({
                                isEdit1: 0
                            })
                        } else {
                            message.info('患者信息修改失败');
                        }
                    },
                    error: err => {
                        console.log(err);
                    }
                });
            }
        })
    }
    //点击编辑患者家庭信息
    handleChangePatientFamilyInfo(key) {
        if (key === 0) {
            //清除数据，以防再次编辑
            this.props.form.setFieldsValue({
                keys: [],
            });
            uuid = 0;
        }
        if (key === 1) {
            let count = this.state.patientInfo.familydata ? this.state.patientInfo.familydata.length : 0;
            for (let i = 0; i < count; i++) {
                this.add();
            }
        }
        this.setState({
            isEdit2: key
        }, () => {
            if (key === 1) {
                let values = this.state.patientInfo;
                let myObject = {};
                if (values.familydata.length) {
                    if (values.familydata[0] != null) {
                        uuid = values.familydata.length;
                        values.familydata.map((item, i) => {
                            let v1 = 'name1' + i;
                            let v2 = 'relationship1' + i;
                            let v3 = 'gender1' + i;
                            let v4 = 'birthday1' + i;
                            let v5 = 'phone1' + i;
                            myObject[v1] = item.name;
                            myObject[v2] = item.relationship;
                            myObject[v3] = item.gender;
                            myObject[v4] = item.birthday ? moment(item.birthday) : null;
                            myObject[v5] = item.phone;
                        })
                    }
                }
                this.props.form.setFieldsValue({

                })
                this.props.form.setFieldsValue(myObject);
            }
        })
    }
    //保存患者家庭信息
    savePatientFamilyInfo() {
        this.props.form.validateFields((err, fieldsValue) => {
            console.log(err, fieldsValue);
            if (!err) {
                const values = {
                    ...fieldsValue,
                };
                let familyData = [];
                values.keys.map(i => {
                    let v1 = 'name1' + i;
                    let v2 = 'relationship1' + i;
                    let v3 = 'gender1' + i;
                    let v4 = 'birthday1' + i;
                    let v5 = 'phone1' + i;
                    values[v1] = fieldsValue[v1];
                    values[v2] = fieldsValue[v2];
                    values[v3] = fieldsValue[v3];
                    values[v4] = fieldsValue[v4] ? fieldsValue[v4].format('YYYY-MM-DD') : undefined;
                    values[v5] = fieldsValue[v5];
                    familyData.push({ name: values[v1], relationship: values[v2], gender: values[v3], birthday: values[v4], phone: values[v5] })
                })
                console.log(familyData);
                let url = allRouter.patientOrigin + '/patient/update';
                $.ajax({
                    url: url,
                    type: "post",
                    async: true,
                    traditional: true,
                    headers: { Authorization: 'Bearer '+sessionStorage.getItem('token')},
                    data: {
                        id: this.state.patientInfo._id,
                        familydata: JSON.stringify(familyData),
                    },
                    success: data => {
                        console.log(data);
                        if (data.code === 200) {
                            message.info('患者信息修改成功');
                            this.getThisPatientInfo();
                            this.setState({
                                isEdit2: 0
                            });
                            //清除数据，以防再次编辑
                            this.props.form.setFieldsValue({
                                keys: [],
                            });
                            uuid = 0;
                        } else {
                            message.info('患者信息修改失败');
                        }
                    },
                    error: err => {
                        console.log(err);
                    }
                });
            }
        })
    }
    //移除家庭成员
    remove(k) {
        const { form } = this.props;
        const keys = form.getFieldValue('keys');
        if (keys.length === 0) {
            return;
        }
        descCount++;
        form.setFieldsValue({
            keys: keys.filter(key => key !== k),
        });
    }
    //增加家庭成员
    add() {
        const { form } = this.props;
        const keys = form.getFieldValue('keys');
        const nextKeys = keys.concat(uuid);
        console.log(nextKeys);
        uuid++;
        form.setFieldsValue({
            keys: nextKeys,
        });
    }
    //禁用今天以后的日期
    disabledDate(val) {
        if (val) {
            return val.valueOf() > Date.now();
        } else {
            return false;
        }
        //return current.valueOf() > Date.now();
    }
    //选择日期，计算年龄
    calculateAge(date, dateString) {
        if (date) {
            let bornYear = date.format('YYYY');
            let currentYear = new Date().getFullYear();
            this.setState({
                age: currentYear - bornYear
            })
        } else {
            this.setState({
                age: 0,
            })
        }
    }
    //病例打印
    handlePrint(e){
        e.stopPropagation();
    }
    //病例编辑
    handleCase(e){
        e.stopPropagation();
        uuid = 0;
        const { form } = this.props;
        form.setFieldsValue({
            keys: [],
        });
        this.setState({
            tab1Status:false,
        });
    }
    //病例保存
    handleSaveTriage(e){
        e.stopPropagation();
        this.props.form.validateFields((err, fieldsValue) => {
            console.log(err, fieldsValue);
            if(err){return;}
            //把状态调整为不可修改状态
            this.setState({
                tab1Status:true,
                // fillState:true,
            });
            const values = {
                ...fieldsValue,
                'illDate': fieldsValue['illDate'].format('YYYY-MM-DD HH:MM'),
            };
            console.log(values);
            let irritabilityDetails = [];
            irritabilityDetails.push({allergyOrigin:values.allergyOrigin1,allergyReact:values.allergyReact1,allergyProcess:values.allergyReact1})
            values.keys1.map(i=>{
                let v1='allergyOrigin1'+i;
                let v2='allergyReact1'+i;
                let v3='allergyProcess1'+i;
                values[v1]=fieldsValue[v1];
                values[v2]=fieldsValue[v2];
                values[v3]=fieldsValue[v3];
                irritabilityDetails.push({allergyOrigin:values[v1],allergyReact:values[v2],allergyProcess:values[v3]})
            });
            console.log(irritabilityDetails);
            let irritabilityDetails1=[];
            irritabilityDetails.map(item=>{
                if( JSON.stringify(item)!=='{}'){
                    irritabilityDetails1.push(item);
                }
            });
            let url=allRouter.patientOrigin+'/surgicalTreatment/treatmentInformation';
            $.ajax({
                url: url,
                type: "post",
                async: true,
                traditional: true,
                headers: { Authorization: 'Bearer '+sessionStorage.getItem('token')},
                data: {
                    clinicname: this.state.patientInfo.medica.length===0?'':this.state.patientInfo.medica[0].clinicname,//门店
                    department: this.state.patientInfo.medica.length===0?'':this.state.patientInfo.medica[0].department, //科室
                    doctorid:this.state.patientInfo.medica.length===0?'':this.state.patientInfo.medica[0].doctorid,
                    doctorname:this.state.patientInfo.medica.length===0?'':this.state.patientInfo.medica[0].doctorname,
                    id:this.state.patientInfo._id,//患者id
                    data:JSON.stringify({
                        seedoctortime:values.illDate,//发病日期
                        action:values.symptom, //主诉
                        nowmedical:values.medicalHistory ,  //现病史
                        historymedical:values.oldMedicalHistory ,  //既往史
                        irritability:values.allergy,  // 过敏史
                        irritabilityDetails:irritabilityDetails1.join('') === ''?'':irritabilityDetails1,//过敏史详情
                        personage:values.personalHistory ,    //个人史
                        family:values.familyHistory,   //家族史
                        tentative:values.preliminaryDiagnosis, //初步诊断
                        treatmentoptions:values.treatmentOpinion, // 治疗意见
                        signmes: {pulse:values.pulse,breathe: values.breath,bloodpressure:values.bloodPressure  },//体征信息
                    })
                },
                success:data => {
                    //  console.log(data);
                    if(data.code===200){
                        message.info('保存成功',);
                        this.getThisPatientInfo();
                        
                    } else{
                        message.info('保存失败');
                    }
                },
                error:err=>{
                    console.log(err);
                }
            });
        })
    }
    //分页
    changePage(pageindex) {
        this.setState({
            pageindex
        });
        this.getPatientPayDetails(pageindex);
    }
    //取消费用预览模态框
    handleCancel1() {
        this.setState({
            visible1: false,
        });
    }
    //显示模态框
    showModal(text,orderid){
        let totalmoney=0;
        let lessmoney=0;
        let orderID='';
        if(text.length){
            text.forEach((item,i)=>{
                item.index=i+1;
                totalmoney+=item.p_dismoney-0;
                if(!item.p_refundstate){
                    lessmoney+=item.p_dismoney-0;
                }
            })
        }
        console.log(totalmoney);
        console.log(lessmoney);
        this.setState({
            visible1: true,
            feePreviewData:text,
            totalmoney,
            lessmoney,
            orderID:orderid,
        })
    }
    //过敏史切换
    handleAllergyChange(e){
        console.log(e.target.value);
        if(e.target.value==='有') {
            this.setState({
                allergyExisted: 1
            })
        }else{
            this.setState({
                allergyExisted: 0
            })
        }
    }
    //是否选择了证件类型
    handleSelectIdCard(value){
        console.log(value);
        if(value){
            this.setState({
                isAlreadyChosedIdCard:true,
            })
        }
    }
    //panel变化函数
    handlePanelChange(key){
       //清除数据，以防再次编辑
       if(!key) return;
       uuid1 = 0;
       this.props.form.setFieldsValue({
        keys1: [],
      });
      let count=this.state.patientTraigeInfo[key-1].irritabilityDetails&&this.state.patientTraigeInfo[key-1].irritabilityDetails.length;
        for(let i=1;i<count;i++){
            this.add1();
        }
    }
    render() {
        const { getFieldDecorator,getFieldValue} = this.props.form;
        const formItemLayout = { labelCol: { span: 2 }, wrapperCol: { span: 21 } };
        const formItemLayout1 = { labelCol: { span: 7 }, wrapperCol: { span: 17 } };
        //过敏源增加或减少
        getFieldDecorator('keys1', { initialValue: []});
        const keys1 = getFieldValue('keys1');
        // const formItems1 = keys1.map((k, index) => {
        //     return(
        //         <Row key={index}>
        //             <Col span={5} offset={2}>
        //                 <FormItem {...formItemLayout} label="">
        //                     {getFieldDecorator('allergyOrigin1'+k,{
        //                         rules:[
        //                             {max:50,message:'最多不超过50字'}
        //                         ]
        //                     })(
        //                         <Input disabled={this.state.tab1Status} placeholder="过敏源"/>
        //                     )}
        //                 </FormItem>
        //             </Col>
        //             <Col span={5} offset={1}>
        //                 <FormItem {...formItemLayout}>
        //                     {getFieldDecorator('allergyReact1'+k,{
        //                         rules:[
        //                             {max:50,message:'最多不超过50字'}
        //                         ]
        //                     })(
        //                         <Input disabled={this.state.tab1Status} placeholder="过敏反应"/>
        //                     )}
        //                 </FormItem>
        //             </Col>
        //             <Col span={5} offset={1}>
        //                 <FormItem {...formItemLayout}>
        //                     {getFieldDecorator('allergyProcess1'+k,{
        //                         rules:[
        //                             {max:10,message:'最多不超过10字'}
        //                         ]
        //                     })(
        //                         <Input disabled={this.state.tab1Status} placeholder="过敏程度"/>
        //                     )}
        //                 </FormItem>
        //             </Col>
        //             {keys1.length > 0 ? (
        //                 <Col span={5}>
        //                     <Button onClick={() => this.remove1(k)} type="primary" disabled={this.state.tab1Status}>
        //                         <Icon type="minus" />
        //                     </Button>
        //                 </Col>
        //             ) : null}
        //         </Row>
        //     )
        // });
       // 家庭成员信息
        getFieldDecorator('keys', { initialValue: [] });
        const keys = getFieldValue('keys');
        const formItems = keys.map((k, index) => {
            return (
                <Row key={index}>
                    <Col span={4}>姓名：
                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block' }}>
                            {getFieldDecorator('name1' + k, {
                                rules: [{ max: 20, message: '最多不能超过20个字' },
                                    { pattern: /^([\u4e00-\u9fa5]|[a-zA-Z0-9])+$/, message: '请输入中文或英文或数字' }],
                            })(
                                <Input placeholder="请输入姓名" />
                            )}
                        </FormItem>
                    </Col>
                    <Col span={4}>关系：
                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block' }}>
                            {getFieldDecorator('relationship1' + k, {
                                rules: [
                                    { max: 10, message: '最多不能超过10个字' },
                                    { pattern: /^([\u4e00-\u9fa5])+$/,message: '请输入中文' }
                                    ]
                            })(
                                <Input placeholder="请输入与患者的关系" />
                            )}
                        </FormItem>
                    </Col>
                    <Col span={4}>性别：
                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block', width: '150px' }}>
                            {getFieldDecorator('gender1' + k, {
                            })(
                                <Select placeholder='请选择性别' style={{ width: '100%' }} >
                                    <Option value='男'>男</Option>
                                    <Option value='女'>女</Option>
                                    <Option value='不详'>不详</Option>
                                </Select>
                            )}
                        </FormItem>
                    </Col>
                    <Col span={5}>出生年月：
                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block', }}>
                            {getFieldDecorator('birthday1' + k, {
                            })(
                                <DatePicker allowClear placeholder='出生日期' disabledDate={(val) => this.disabledDate(val)} />
                            )}
                        </FormItem>
                    </Col>
                    <Col span={5}>手机号：
                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block', width: '200px' }}>
                            {getFieldDecorator('phone1' + k, {
                                rules: [{ pattern: /^(1[34578]\d{9})$/, message: '请输入正确的手机号' }]
                            })(
                                <Input placeholder="请输入11位手机号" />
                            )}
                        </FormItem>
                    </Col>
                    <Col span={2}>
                        <Button onClick={() => this.remove(k)} type="primary">
                            <Icon type="minus" />
                        </Button>
                    </Col>
                </Row>
            );
        });

        const { patientInfo, patientOriginList, userTypeManageList } = this.state;
        const columns = [
            {
            title: '诊所名称',
            dataIndex: 'clinicname',
            width:300,
        }, {
            title: '订单号',
            dataIndex: 'orderid',
            width:300,
        }, {
            title: '消费时间',
            dataIndex: 'paytime',
            width:300,
        }, {
            title: '消费金额',
            dataIndex: 'consumptionmoney',
            width:300,
        }, {
            title: '实收金额',
            dataIndex: 'receipts',
            width:300,
        }, {
            title: '支付状态',
            dataIndex: 'paystate',
            width:300,
            render: text => <Button disabled style={{background:'#43B1A5',color:'#fff',cursor:'default'}} >成功</Button>
        }, {
            title: '操作',
            dataIndex:'chargeschedule',
            width:300,
            render: (text,record) => <Button onClick={this.showModal.bind(this,text,record.orderid,)}>查看详情</Button>
        }];
        //费用预览表格
        const FeePreview = [
            {
                title: '收费名称',
                dataIndex: 'p_name',
                width: 200,
            },{
                title: '数量',
                dataIndex: 'p_Number',
                width: 100,
            },{
                title: '单价',
                dataIndex: 'p_price',
                width: 100,
            },{
                title: '规格',
                dataIndex: 'p_speci',
                width: 100,
            },{
                title: '金额',
                width: 100,
                dataIndex: 'p_money',
            },{
                title: '折扣',
                dataIndex: 'p_discount',
                width: 100,
            },{
                title: '折后金额',
                width: 100,
                dataIndex: 'p_dismoney',
            },{
                title: '接诊医生',
                width: 250,
                dataIndex: 'p_doctor',
            },{
                title: '状态',
                width: 250,
                dataIndex: 'p_refundstate',
                render:text=><Button disabled style={{background:text?'#DE6262':'#43B1A5',color:'white',cursor:'default'}}>{text?'已退费':'已付款'}</Button>
            }
        ];
        return (
            <div className='container triage'>
                <div className='subcontainer'>
                    <div className='btnBox'>
                        <Button type={this.state.tabKey === 1 ? 'primary' : ''} onClick={() => this.changeTab(1)}>基本信息</Button>
                        <Button type={this.state.tabKey === 2 ? 'primary' : ''} onClick={() => this.changeTab(2)}>就诊信息</Button>
                        <Button type={this.state.tabKey === 3 ? 'primary' : ''} onClick={() => this.changeTab(3)}>消费信息</Button>
                        <Button disabled type={this.state.tabKey === 4 ? 'primary' : ''} onClick={() => this.changeTab(4)}>预约信息</Button>
                        <Button disabled type={this.state.tabKey === 5 ? 'primary' : ''} onClick={() => this.changeTab(5)}>随访信息</Button>
                    </div>
                    <div className='box'>
                        <div className='patientinfo'>
                            <img src={require('../../../images/patientDefault.png')} className="default-img"/>
                            <h6>{patientInfo.username}</h6>
                            <p>{patientInfo.userphone}</p>
                            <div className='patientinfoa'>
                                <p>性别：{patientInfo.usersex}</p>
                                <p>年龄：{(new Date().getFullYear() - (patientInfo.userbirthday ? patientInfo.userbirthday.slice(0, 4) : 1)) + '岁'}</p>
                                <p>婚配：{patientInfo.usermarriage}</p>
                                <p>身高：{patientInfo.signmes ? patientInfo.signmes[0].height === 0 ? '' : patientInfo.signmes[0].height + 'cm' : ''}</p>
                                <p>脉搏：{patientInfo.medica?patientInfo.medica.length!==0?patientInfo.medica[0].signmes?patientInfo.medica[0].signmes.pulse+'次/每分钟':'':'':''}</p>
                                <p>呼吸：{patientInfo.medica?patientInfo.medica.length!==0?patientInfo.medica[0].signmes?patientInfo.medica[0].signmes.breathe+'次/每分钟':'':'':''}</p>
                                <p>血压：{patientInfo.medica?patientInfo.medica.length!==0?patientInfo.medica[0].signmes?patientInfo.medica[0].signmes.bloodpressure+'mmHg':'':'':''}</p>
                                <p>过敏史：{patientInfo.medica?patientInfo.medica.length!==0?patientInfo.medica[0].irritability:'':''}</p>
                            </div>
                        </div>
                        <div className='patientinfo1' style={{ flex: 1 }}>
                            {
                                this.state.tabKey === 1 ?
                                    <div className='addpatient'>
                                        <div className='bxa'>
                                            <div className='addpatient1'>
                                                <p>基本信息</p>
                                                {this.state.isEdit1 === 0 ? <Button onClick={this.handleChangePatientInfo.bind(this, 1)}><Icon type="form" />编辑</Button> :
                                                    <div>
                                                        <Button style={{ marginLeft: '10px' }} type="primary" onClick={this.savePatientInfo.bind(this)}>保存</Button>
                                                        <Button onClick={this.handleChangePatientInfo.bind(this, 0)}>取消</Button>
                                                    </div>
                                                }
                                            </div>
                                            <div className='addpatient2 can-not-be-hidden'>
                                                <Row>
                                                    <Col span={12}>姓名：{this.state.isEdit1 === 0 ? patientInfo.username :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block' }}>
                                                            {getFieldDecorator('name', {
                                                                rules: [
                                                                    { required: true, message: '请输入患者姓名' },
                                                                    { max: 20, message: '最多不能超过20个字' },
                                                                    { pattern: /^([\u4e00-\u9fa5]|[a-zA-Z0-9])+$/, message: '请输入中文或英文或数字' },]
                                                            })(
                                                                <Input placeholder="请输入患者姓名" />
                                                            )}
                                                        </FormItem>}
                                                    </Col>
                                                    <Col span={12}>性别：{this.state.isEdit1 === 0 ? patientInfo.usersex :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block', width: '200px' }}>
                                                            {getFieldDecorator('gender', {
                                                                rules: [{ required: true, message: '请选择性别' }],
                                                            })(
                                                                <Select style={{ width: '100%' }} placeholder="请选择性别">
                                                                    <Option value='男'>男</Option>
                                                                    <Option value='女'>女</Option>
                                                                    <Option value='不详'>不详</Option>
                                                                </Select>
                                                            )}
                                                        </FormItem>}
                                                    </Col>
                                                </Row>
                                                <Row>
                                                    <Col span={12}>出生年月：{this.state.isEdit1 === 0 ? patientInfo.userbirthday :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block' }}>
                                                            {getFieldDecorator('birthday', {
                                                                rules: [{ required: true, message: '请选择出生日期' }],
                                                            })(
                                                                <DatePicker allowClear placeholder='出生日期' disabledDate={(val) => this.disabledDate(val)} onChange={this.calculateAge.bind(this)} />
                                                            )}
                                                        </FormItem>}</Col>
                                                    <Col span={12}>年龄：{this.state.age === 0 ? (new Date().getFullYear() - (patientInfo.userbirthday ? patientInfo.userbirthday.slice(0, 4) : 1)) : this.state.age}岁</Col>
                                                </Row>
                                                <Row>
                                                    <Col span={12}>手机号：{this.state.isEdit1 === 0 ? patientInfo.userphone :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block' }}>
                                                            {getFieldDecorator('phone', {
                                                                rules: [{ pattern: /^(1[34578]\d{9})$/, message: '请输入正确的手机号' }]
                                                            })(
                                                                <Input placeholder="请输入11位手机号" />
                                                            )}
                                                        </FormItem>}</Col>
                                                    <Col span={12}>微信号：--</Col>
                                                </Row>
                                                <Row>
                                                    <Col span={12}>身高：{this.state.isEdit1 === 0 ? (patientInfo.signmes ? patientInfo.signmes[0].height === 0 ? '' : patientInfo.signmes[0].height + 'cm' : '') :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block' }}>
                                                            {getFieldDecorator('height', {
                                                            })(
                                                                <InputNumber min={0} max={999} step={1} precision={0} placeholder="请输入身高" />
                                                            )}
                                                        </FormItem>
                                                    }</Col>
                                                    <Col span={12}>体重：{this.state.isEdit1 === 0 ? (patientInfo.signmes ? patientInfo.signmes[0].weight === 0 ? '' : patientInfo.signmes[0].weight + 'Kg' : '') :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block' }}>
                                                            {getFieldDecorator('weight', {
                                                            })(
                                                                <InputNumber min={0} max={999} step={1} precision={0} placeholder="请输入体重" />
                                                            )}
                                                        </FormItem>}</Col>
                                                </Row>
                                                <Row>
                                                    <Col span={12}>证件类型：{this.state.isEdit1 === 0 ? patientInfo.userpapers :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block', width: '200px' }}>
                                                            {getFieldDecorator('cardType', {
                                                            })(
                                                                <Select placeholder='请选择证件类型' style={{ width: '100%' }} onChange={this.handleSelectIdCard.bind(this)}>
                                                                    <Option value='二代身份证'>二代身份证</Option>
                                                                </Select>
                                                            )}
                                                        </FormItem>}</Col>
                                                    <Col span={12}>证件号码：{this.state.isEdit1 === 0 ? patientInfo.userIDcard :
                                                        <FormItem style={{ display: 'inline-block' }}>
                                                            {getFieldDecorator('card', {
                                                                rules: [{ pattern: /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X|x)$/, message: '请输入18位身份证号' }]
                                                            })(<Input disabled={this.state.isAlreadyChosedIdCard?false:true} placeholder=" 输入18位二代身份证号码" />)}
                                                        </FormItem>}</Col>
                                                </Row>
                                                <Row>
                                                    <Col span={12}>名族：{this.state.isEdit1 === 0 ? patientInfo.usernation :
                                                        <FormItem {...{ labelCol: { span: 0 }, wrapperCol: { span: 24 } }} style={{ display: 'inline-block', width: '200px' }} >
                                                            {getFieldDecorator('nation', {

                                                            })(
                                                                <Select style={{ width: '100%' }} placeholder="请选择">
                                                                    {nations.map(item => {
                                                                        return <Option key={item.id} value={item.name}>{item.name}</Option>
                                                                    })}
                                                                </Select>
                                                            )}
                                                        </FormItem>}</Col>
                                                    <Col span={12}>婚配：{this.state.isEdit1 === 0 ? patientInfo.usermarriage :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block', width: '200px' }}>
                                                            {getFieldDecorator('marryState', {
                                                            })(
                                                                <Select placeholder='请选择' style={{ width: '100%' }} >
                                                                    <Option value='已婚'>已婚</Option>
                                                                    <Option value='未婚'>未婚</Option>
                                                                    <Option value='丧偶'>丧偶</Option>
                                                                    <Option value='离异'>离异</Option>
                                                                </Select>
                                                            )}
                                                        </FormItem>}</Col>
                                                </Row>
                                                <Row>
                                                    <Col span={12}>职业：{this.state.isEdit1 === 0 ? patientInfo.userproffession :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block' }}>
                                                            {getFieldDecorator('job', {
                                                                rules: [
                                                                    { max: 20, message: '最多不能超过20个字符' },
                                                                    { pattern: /^([\u4e00-\u9fa5]|[a-zA-Z])+$/, message: '请输入中文或英文' }]
                                                            })(
                                                                <Input placeholder="请输入职业" />
                                                            )}
                                                        </FormItem>}</Col>
                                                    <Col span={12}>工作地址：{this.state.isEdit1 === 0 ? patientInfo.userworkunit :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block' }}>
                                                            {getFieldDecorator('jobAddress', {
                                                                rules: [
                                                                    { max: 200, message: '最多不能超过200个字符' },
                                                                    { pattern: /^\S+$/, message: '请不要输入空格'}
                                                                    ]
                                                            })(
                                                                <Input placeholder="请填写工作地址" />
                                                            )}
                                                        </FormItem>}</Col>
                                                </Row>
                                                <Row>
                                                    <Col span={12}>会员类型：{
                                                        this.state.isEdit1 === 0 ? (userTypeManageList.length ? userTypeManageList.map(item => {
                                                                if (item._id === patientInfo.membertypes) {
                                                                    return item.name
                                                                }
                                                            }) : '') :
                                                            <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block', width: '200px' }}>
                                                                {getFieldDecorator('userType', {
                                                                })(
                                                                    <Select placeholder='请选择会员类型' style={{ width: '100%' }} >
                                                                        {this.state.userTypeManageList.map(item => {
                                                                            return <Option value={item._id} key={item._id}>{item.name}</Option>
                                                                        })}
                                                                    </Select>
                                                                )}
                                                            </FormItem>
                                                    }</Col>
                                                    <Col span={12}>患者来源：{
                                                        this.state.isEdit1 === 0 ? (patientOriginList.length ? patientOriginList.map(item => {
                                                            if (item._id === patientInfo.usersource) {
                                                                return item.name
                                                            }
                                                        }) : '') : <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block', width: '200px' }}>
                                                            {getFieldDecorator('patientOrigin', {
                                                            })(
                                                                <Select placeholder='请选择患者来源' style={{ width: '100%' }} >
                                                                    {this.state.patientOriginList.map(item => {
                                                                        return <Option value={item._id} key={item._id}>{item.name}</Option>
                                                                    })}
                                                                </Select>
                                                            )}
                                                        </FormItem>
                                                    }</Col>
                                                </Row>
                                                <Row>
                                                    <Col span={12}>患者卡号：{this.state.isEdit1 === 0 ? patientInfo.membercardno :
                                                        <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block' }}>
                                                            {getFieldDecorator('patientCardId', {
                                                                rules: [
                                                                    { max: 20, message: '最多不能超过20个字符' },
                                                                    { pattern: /^([a-zA-Z0-9])+$/, message: '请输入英文或数字' }
                                                                ]
                                                            })(
                                                                <Input placeholder="请输入ID" />
                                                            )}
                                                        </FormItem>}</Col>
                                                    <Col span={12}>家庭住址：{this.state.isEdit1 === 0 ? function(){
                                                            let str = '';
                                                            if(patientInfo.userprovince){
                                                                str += patientInfo.userprovince;
                                                                if(patientInfo.useraddress){
                                                                    str +=' '+patientInfo.useraddress;
                                                                }
                                                            }
                                                            return str;
                                                        }() :
                                                        <div style={{ display: 'inline-block' }}>
                                                            <FormItem labelCol={{ span: 0 }} wrapperCol={{ span: 24 }} style={{ display: 'inline-block', width: '220px' }} >
                                                                {getFieldDecorator('address', {
                                                                    rules: [{ type: 'array', message: '请选择家庭住址所在的地区！' }],
                                                                })(
                                                                    <Cascader options={region} placeholder="请选择省市区" style={{ width: '100%' }} />
                                                                )}
                                                            </FormItem>
                                                            <FormItem style={{ display: 'inline-block' }}>
                                                                {getFieldDecorator('addressDetail', {
                                                                    rules: [
                                                                        { max: 200, message: '最多不能超过200个字符' },
                                                                        { pattern: /^\S+$/, message: '请不要输入空格'}
                                                                        ]
                                                                })(<Input placeholder="请输入详细地址" />)}
                                                            </FormItem>
                                                        </div>
                                                    }</Col>
                                                </Row>
                                                <Row>
                                                    <Col span={12}>邮箱：{this.state.isEdit1 === 0 ? patientInfo.useremail :
                                                        <FormItem {...{ labelCol: { span: 0 }, wrapperCol: { span: 24 } }} style={{ display: 'inline-block' }}>
                                                            {getFieldDecorator('email', {
                                                                rules: [{
                                                                    type: 'email', message: '请输入正确格式邮箱',
                                                                }],
                                                            })(
                                                                <Input placeholder="请输入正确格式邮箱" />
                                                            )}
                                                        </FormItem>}</Col>
                                                </Row>
                                            </div>
                                        </div>
                                        <div className='bxa' style={{ marginTop: "20px" }}>
                                            <div className='addpatient1'>
                                                <p>家庭成员</p>
                                                {this.state.isEdit2 === 0 ? <Button onClick={this.handleChangePatientFamilyInfo.bind(this, 1)}><Icon type="form" />编辑</Button> :
                                                    <div>
                                                        <Button style={{ marginLeft: '10px' }} type="primary" onClick={this.savePatientFamilyInfo.bind(this)}>保存</Button>
                                                        <Button onClick={this.handleChangePatientFamilyInfo.bind(this, 0)} style={{ marginLeft: '10px' }}>取消</Button>
                                                        <Button type="primary" onClick={this.add.bind(this)}><Icon type="plus" />增加新成员</Button>
                                                    </div>
                                                }
                                            </div>
                                            <div className='addpatient2'>
                                                {patientInfo.familydata ? patientInfo.familydata[0] != null ? (
                                                    patientInfo.familydata.length ? this.state.isEdit2 === 0 ? patientInfo.familydata.map((item, index) =>
                                                        <Row key={index}>
                                                            {this.state.isEdit2 === 0 ? <Col span={4}>姓名：{item.name}
                                                            </Col> : ''}
                                                            {this.state.isEdit2 === 0 ? <Col span={4}>关系：{item.relationship}
                                                            </Col> : ''}
                                                            {this.state.isEdit2 === 0 ? <Col span={4}>性别：{item.gender}
                                                            </Col> : ''}
                                                            {this.state.isEdit2 === 0 ? <Col span={5}>出生年月：{item.birthday}
                                                            </Col> : ''}
                                                            {this.state.isEdit2 === 0 ? <Col span={5}>手机号：{item.phone}
                                                            </Col> : ''}
                                                        </Row>
                                                    ) : '' : '') : '' : ''}
                                                {this.state.isEdit2 === 0 ? '' : formItems}
                                            </div>
                                        </div>
                                    </div>
                                    :
                                    this.state.tabKey === 2 ?
                                        <Collapse accordion defaultActiveKey={["1"]} onChange={this.handlePanelChange.bind(this)}>
                                            <Panel showArrow={false} header={<div className="clearfix caozuo"><h4>历史病例</h4></div>} key="0" disabled>
                                            </Panel>
                                            {this.state.patientTraigeInfo.map((values,i)=>{
                                                return <Panel  header={<div className="clearfix caozuo"><h4>{values.department+'-初诊-'+values.clinicname}</h4>
                                                    <Button className="moban" style={{marginLeft:'20px'}} icon="laptop" onClick={this.handlePrint.bind(this)}>打印</Button>
                                                    {this.state.tabKey1===1?(this.state.tab1Status?<Button className="moban" onClick={this.handleCase.bind(this)}><Icon type="form"/>编辑</Button>:
                                                        <Button className="moban" onClick={this.handleSaveTriage.bind(this)}>保存</Button> ):''}</div>} key={i+1}>
                                                    <div>
                                                        <div className="patient-details-btn-style" style={{borderBottom:'1px solid #ddd'}}>
                                                            <Button type={this.state.tabKey1 === 1 ? 'primary' : ''} onClick={() => this.changeTab1(1)}>病例</Button>
                                                            <Button type={this.state.tabKey1 === 2 ? 'primary' : ''}  disabled onClick={() => this.changeTab1(2)}>处方</Button>
                                                            <Button type={this.state.tabKey1 === 3 ? 'primary' : ''} onClick={() => this.changeTab1(3)}>外科治疗</Button>
                                                        </div>
                                                        {
                                                            this.state.tabKey1===1?
                                                                <div  className="treat-patient-content">
                                                                    <Row style={{marginTop:'10px'}}>
                                                                        <Col span={24}>
                                                                            <FormItem {...formItemLayout} label="发病日期"  >
                                                                                {getFieldDecorator('illDate',{
                                                                                    initialValue:values.seedoctortime?moment(values.seedoctortime):undefined,
                                                                                    rules: [{ required: true, message: '请选择发病日期' }]
                                                                                })(
                                                                                    <DatePicker  style={{color:'rgba(0, 0, 0, 0.65)',width: '100%'}} disabled={this.state.tab1Status} format="YYYY-MM-DD HH:mm"  showTime={{ defaultValue: moment('00:00:', 'HH:mm') }} disabledDate={(val) => this.disabledDate(val)} />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                    <Row>
                                                                        <Col span={24}>
                                                                            <FormItem {...formItemLayout} label="主诉"  className="my-clear-fix" >
                                                                                {getFieldDecorator('symptom',{
                                                                                    initialValue:values.action,
                                                                                    rules: [{ required: true, message: '请填写主诉' },
                                                                                        { max: 500, message: '最多不超过500字' }]
                                                                                })(
                                                                                    <TextArea disabled={this.state.tab1Status} data='a' style={{color:'rgba(0, 0, 0, 0.65)'}} placeholder="请输入主诉" autosize={{ minRows: 1, maxRows: 6 }}  />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                    <Row>
                                                                        <Col span={24}>
                                                                            <FormItem {...formItemLayout} label="现病史"  className="my-clear-fix">
                                                                                {getFieldDecorator('medicalHistory',{
                                                                                    initialValue:values.nowmedical,
                                                                                    rules: [{ max: 500, message: '最多不超过500字' }]
                                                                                })(
                                                                                    <TextArea style={{color:'rgba(0, 0, 0, 0.65)'}} disabled={this.state.tab1Status} data='b' placeholder="请输入现病史" autosize={{ minRows: 1, maxRows: 6 }} />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                    <Row>
                                                                        <Col span={24}>
                                                                            <FormItem {...formItemLayout} label="既往史" className="my-clear-fix">
                                                                                {getFieldDecorator('oldMedicalHistory',{
                                                                                    initialValue:values.historymedical,
                                                                                    rules: [{ max: 500, message: '最多不超过500字' }]
                                                                                })(
                                                                                    <TextArea style={{color:'rgba(0, 0, 0, 0.65)'}} disabled={this.state.tab1Status} data='c' placeholder="请输入既往史" autosize={{ minRows: 1, maxRows: 6 }} />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                    <Row>
                                                                        <Col span="24">
                                                                            <FormItem {...formItemLayout} label="过敏史">
                                                                                {getFieldDecorator('allergy', {
                                                                                    initialValue:values.irritability,
                                                                                })(
                                                                                    <Radio.Group  onChange={this.handleAllergyChange.bind(this)} disabled={this.state.tab1Status}>
                                                                                        <Radio value="无">无</Radio>
                                                                                        <Radio value="有">有</Radio>
                                                                                    </Radio.Group>
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                    {(values.irritability==="有"?(this.state.allergyExisted===1&&values.irritability==="有"):(this.state.allergyExisted===1))?<div>
                                                                        <Row>
                                                                        <Col span={5} offset={2}>
                                                                            <FormItem {...formItemLayout} label="">
                                                                                {getFieldDecorator('allergyOrigin1',{
                                                                                    rules:[
                                                                                        {max:50,message:'最多不超过50字'}
                                                                                    ],
                                                                                    initialValue:values.irritabilityDetails.length?values.irritabilityDetails[0].allergyOrigin:undefined,
                                                                                })(
                                                                                    <Input disabled={this.state.tab1Status} placeholder="过敏源"/>
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                        <Col span={5} offset={1}>
                                                                            <FormItem {...formItemLayout}>
                                                                                {getFieldDecorator('allergyReact1',{
                                                                                    rules:[
                                                                                        {max:50,message:'最多不超过50字'}
                                                                                    ],
                                                                                    initialValue:values.irritabilityDetails?values.irritabilityDetails[0].allergyReact:undefined,
                                                                                })(
                                                                                    <Input disabled={this.state.tab1Status} placeholder="过敏反应"/>
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                        <Col span={5} offset={1}>
                                                                            <FormItem {...formItemLayout}>
                                                                                {getFieldDecorator('allergyProcess1',{
                                                                                    rules:[
                                                                                        {max:10,message:'最多不超过10字'}
                                                                                    ],
                                                                                    initialValue:values.irritabilityDetails.length?values.irritabilityDetails[0].allergyProcess:undefined,
                                                                                })(
                                                                                    <Input disabled={this.state.tab1Status} placeholder="过敏程度"/>
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                        <Col span={5}>
                                                                            <Button  disabled={this.state.tab1Status} onClick={this.add1.bind(this)} type="primary">
                                                                                <Icon type="plus" />
                                                                            </Button>
                                                                        </Col>
                                                                    </Row>
                                                                            {
                                                                                (values.irritability==="有"?(this.state.allergyExisted===1&&values.irritability==="有"):(this.state.allergyExisted===1))?(
                                                                                    keys1.length?keys1.map((k, index) => {
                                                                                    return(
                                                                                        <Row key={index}>
                                                                                            <Col span={5} offset={2}>
                                                                                                <FormItem {...formItemLayout} label="">
                                                                                                    {getFieldDecorator('allergyOrigin1'+k,{
                                                                                                        rules:[
                                                                                                            {max:50,message:'最多不超过50字'}
                                                                                                        ],
                                                                                                        initialValue:values.irritabilityDetails?values.irritabilityDetails[index+1]?values.irritabilityDetails[index+1].allergyOrigin:undefined:undefined,
                                                                                                    })(
                                                                                                        <Input disabled={this.state.tab1Status} placeholder="过敏源"/>
                                                                                                    )}
                                                                                                </FormItem>
                                                                                            </Col>
                                                                                            <Col span={5} offset={1}>
                                                                                                <FormItem {...formItemLayout}>
                                                                                                    {getFieldDecorator('allergyReact1'+k,{
                                                                                                        rules:[
                                                                                                            {max:50,message:'最多不超过50字'}
                                                                                                        ],
                                                                                                        initialValue:values.irritabilityDetails?values.irritabilityDetails[index+1]?values.irritabilityDetails[index+1].allergyReact:undefined:undefined,
                                                                                                    })(
                                                                                                        <Input disabled={this.state.tab1Status} placeholder="过敏反应"/>
                                                                                                    )}
                                                                                                </FormItem>
                                                                                            </Col>
                                                                                            <Col span={5} offset={1}>
                                                                                                <FormItem {...formItemLayout}>
                                                                                                    {getFieldDecorator('allergyProcess1'+k,{
                                                                                                        rules:[
                                                                                                            {max:10,message:'最多不超过10字'}
                                                                                                        ],
                                                                                                        initialValue:values.irritabilityDetails?values.irritabilityDetails[index+1]?values.irritabilityDetails[index+1].allergyProcess:undefined:undefined,
                                                                                                    })(
                                                                                                        <Input disabled={this.state.tab1Status} placeholder="过敏程度"/>
                                                                                                    )}
                                                                                                </FormItem>
                                                                                            </Col>
                                                                                            {keys1.length > 0 ? (
                                                                                                <Col span={5}>
                                                                                                    <Button onClick={() => this.remove1(k,index,i)} type="primary" disabled={this.state.tab1Status}>
                                                                                                        <Icon type="minus" />
                                                                                                    </Button>
                                                                                                </Col>
                                                                                            ) : null}
                                                                                        </Row>
                                                                                    )
                                                                                }):''):''
                                                                            }
                                                                    </div> :''}
                                                                    <Row>
                                                                        <Col span={24}>
                                                                            <FormItem {...formItemLayout} label="个人史"  className="my-clear-fix">
                                                                                {getFieldDecorator('personalHistory',{
                                                                                    initialValue:values.personage,
                                                                                    rules: [{ max: 500, message: '最多不超过500字' }]
                                                                                })(
                                                                                    <TextArea style={{color:'rgba(0, 0, 0, 0.65)'}} disabled={this.state.tab1Status} placeholder="请输入个人史" data='d' autosize={{ minRows: 1, maxRows: 6 }} />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                    <Row>
                                                                        <Col span={24}>
                                                                            <FormItem {...formItemLayout} label="家族史"  className="my-clear-fix">
                                                                                {getFieldDecorator('familyHistory',{
                                                                                    initialValue:values.family,
                                                                                    rules: [{ max: 500, message: '最多不超过500字' }]
                                                                                })(
                                                                                    <TextArea style={{color:'rgba(0, 0, 0, 0.65)'}} disabled={this.state.tab1Status}  placeholder="请输入家族史" data='e' autosize={{ minRows: 1, maxRows: 6 }} />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                    <Row>
                                                                        <Col span={7}>
                                                                            <FormItem {...formItemLayout1} label="脉搏"  >
                                                                                {getFieldDecorator('pulse',{
                                                                                    initialValue:values.signmes?values.signmes.pulse:undefined,
                                                                                    rules:[{pattern:/^\d{2,3}$/,message:'请输入2~3位数字'}]
                                                                                })(
                                                                                    <Input  style={{color:'rgba(0, 0, 0, 0.65)'}} disabled={this.state.tab1Status} addonAfter="次/分钟" placeholder="请输入脉搏次数"/>
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                        <Col span={7}>
                                                                            <FormItem {...formItemLayout1} label="呼吸"  >
                                                                                {getFieldDecorator('breath',{
                                                                                    initialValue:values.signmes?values.signmes.breathe:undefined,
                                                                                    rules:[
                                                                                        {pattern:/^\d{2,3}$/,message:'请输入2~3位数字'}
                                                                                    ]
                                                                                })(
                                                                                    <Input style={{color:'rgba(0, 0, 0, 0.65)'}} disabled={this.state.tab1Status} addonAfter="次/分钟" placeholder="请输入呼吸次数"/>
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                        <Col span={7}>
                                                                            <FormItem {...formItemLayout1} label="血压"  >
                                                                                {getFieldDecorator('bloodPressure',{
                                                                                    initialValue:values.signmes?values.signmes.bloodpressure:undefined,
                                                                                    rules:[
                                                                                        {pattern:/^\d{2,3}$/,message:'请输入2~3位数字'}
                                                                                    ]
                                                                                })(
                                                                                    <Input style={{color:'rgba(0, 0, 0, 0.65)'}} disabled={this.state.tab1Status} addonAfter="mmHg" placeholder="请输入血压"/>
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                    <Row>
                                                                        <Col span={24}>
                                                                            <FormItem {...formItemLayout} label="初步诊断"  className="my-clear-fix">
                                                                                {getFieldDecorator('preliminaryDiagnosis',{
                                                                                    initialValue:values.tentative,
                                                                                    rules: [{ required: true, message: '请填写初步诊断' },
                                                                                        { max: 500, message: '最多不超过500字' }]
                                                                                })(
                                                                                    <TextArea style={{color:'rgba(0, 0, 0, 0.65)'}} disabled={this.state.tab1Status} placeholder="请输入初步诊断" data='f' autosize={{ minRows: 1, maxRows: 6 }} />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                    <Row>
                                                                        <Col span={24}>
                                                                            <FormItem {...formItemLayout} label="治疗意见"  className="my-clear-fix">
                                                                                {getFieldDecorator('treatmentOpinion',{
                                                                                    initialValue:values.treatmentoptions,
                                                                                    rules: [{ required: true, message: '请填写治疗意见' },
                                                                                        { max: 500, message: '最多不超过500字' }]
                                                                                })(
                                                                                    <TextArea style={{color:'rgba(0, 0, 0, 0.65)'}} disabled={this.state.tab1Status} placeholder="请输入治疗意见" data='g' autosize={{ minRows: 1, maxRows: 6 }} />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                </div>
                                                                :this.state.tabKey1===2?'': <div>
                                                                    <Table
                                                                        rowKey="p_name"
                                                                        columns={FeePreview}
                                                                        dataSource={values.Order?values.Order[0].chargeschedule:[]}
                                                                        pagination={false}
                                                                        bordered
                                                                    />
                                                                </div>
                                                        }
                                                    </div>
                                                </Panel>
                                            })}

                                        </Collapse>
                                        :
                                        this.state.tabKey === 3 ?
                                            <div className="xfxx">
                                                <div className='addpatient1'>
                                                    <p>消费信息</p>
                                                </div>
                                                <div className='addpatient2'>
                                                    <Row className="sfze">
                                                        <Col span={4} offset={1}>收费总额：<b>￥{this.state.patientMoney.total}</b></Col>
                                                        <Col span={6}>退费金额：<b>￥{this.state.patientMoney.refound}</b></Col>
                                                    </Row>
                                                </div>
                                                <Table dataSource={this.state.patientOrderInfo} columns={columns} bordered className="xfxx1" pagination={false} rowKey="index"/>
                                                {/*分页*/}
                                                <div className="pagination">
                                                    <Pagination showQuickJumper current={this.state.pageindex} total={ this.state.patientOrderInfo.length||1} defaultPageSize={this.state.pagesize} onChange={this.changePage.bind(this)} />
                                                </div>
                                            </div>
                                            :
                                            this.state.tabKey === 4 ?
                                                <div>444</div>
                                                :
                                                this.state.tabKey === 5 ?
                                                    <div>555</div>
                                                    :
                                                    <div>订单号：78978954567489456</div>
                            }
                        </div>
                        {/*查看详情模态框*/}
                        <Modal
                            title={'费用预览  订单号：'+this.state.orderID}
                            visible={this.state.visible1}
                            onCancel={this.handleCancel1.bind(this)}
                            footer={null}
                            className="large-model spgl2-4-1"
                        >
                            <div>
                                <Row>
                                    <Col span={24} >
                                        <Table
                                            rowKey="index"
                                            columns={FeePreview}
                                            dataSource={this.state.feePreviewData}
                                            pagination={false}
                                            bordered
                                        />
                                    </Col>
                                </Row>
                                <Row style={{marginTop:'20px'}}>
                                    <Col span={2} offset={18}>金额合计:</Col>
                                    <Col span={2} style={{color:'red'}}>￥{this.state.totalmoney?this.state.totalmoney.toFixed(2):0}</Col>
                                </Row>
                                <Row>
                                    <Col span={2} offset={18}>折扣金额:</Col>
                                    <Col span={2} style={{color:'red'}}>￥0.00</Col>
                                </Row>
                                <Row>
                                    <Col span={2} offset={18}>应收金额:</Col>
                                    <Col span={2} style={{color:'red'}}>￥{this.state.lessmoney?this.state.lessmoney.toFixed(2):0}</Col>
                                </Row>
                                <Row>
                                    <Col span={2} offset={18}>实收金额:</Col>
                                    <Col span={2} style={{color:'red'}}>￥{this.state.lessmoney?this.state.lessmoney.toFixed(2):0}</Col>
                                </Row>
                            </div>
                        </Modal>
                    </div>
                </div>
            </div>
        );
    }
}

const PatientInfoDetails = Form.create()(PatientInfoDetails1);
export default PatientInfoDetails;